import request from '@/utils/request'
import { TableListQueryParams, TableListItem } from './data.d'

export const queryList = (params?: TableListQueryParams): Promise<any> => request.get('/pages/list', { params })

export const createData = (data: Omit<TableListItem, 'id'>): Promise<any> => request.post('/pages/list', data)

export const updateData = (id: number, data: Omit<TableListItem, 'id'>): Promise<any> =>
  request.put(`/pages/list/${id}`, data)

export const removeData = (id: number): Promise<any> => request.delete(`/pages/list/${id}`)

export const detailData = (id: number): Promise<any> => request.get(`/pages/list/${id}`)
